﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteJN.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="jnagr.Web.sicpet.Default" %>

<%@ Register Src="~/Controls/checkright.ascx" TagPrefix="uc1" TagName="checkright" %>
<%@ Register Src="~/Controls/spet.ascx" TagPrefix="uc1" TagName="spet" %>
<%@ Register Src="~/Controls/copyright.ascx" TagPrefix="uc1" TagName="copyright" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        var sprovince = "";
        var scity = "";
        var scounty = "";
        var areas = "";
        var se = "";
        var sebm = "";
        var getdata = "";
        var level;
        var markerClusterer;
        var markers = [];
        var devid;
        var XQHID;
        var wchartInstance;
        var chs = "";
        var pt;
        var uid = "";
        var map;
        var data_info;
        var opts;
        var dtOpstart;
        var dtOpend;
        var days;
        var yxdays;
        var ch = new Array("", "", "", "");

        $(function () {
            curmenu('靶标害虫');
            $.ajax({
                type: "post",
                dataType: "json",
                url: "../admin/getinfo.ashx?action=level",
                success: function aa(data) {
                    sprovince = data[0].province;
                    scity = data[0].city;
                    scounty = data[0].county;
                    InitTree();
                    InitMap();
                }
            });
        });

        function InitMapmark() {
            $('#win').datagrid({
                //title: '测报点列表', //表格标题
                url: '../devinfo/GetDev.ashx', //请求数据的页面
                sortName: 'mname', //排序字段
                idField: 'mid', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '95%', //宽度
                height: '95%', //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                method: 'post',
                columns: [[
	                { title: '测报站名', field: 'mname', width: 80, sortable: true }
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "querydev", "dtype": "YBQ" },
                pageNumber: 1, //默认索引页
                pageSize: 500, //默认一页数据条数
                rownumbers: true, //行号
                pageList: [10, 20, 50, 200, 500],
                pagination: false, //是否开启分页                
                onLoadSuccess: function (data) {
                    data_info = [];
                    getdata = data;
                    map.clearOverlays();
                    $.each(data.rows, function (k, v) {
                        data_info.push({ "lng": v["mjd"], "lat": v["mwd"], "mlevel": v["DevType"], "mname": v["devname"], "madd": v["DevLocation"], "updata": v["updata"], "devid": v["DevID"], "note": v["chn0"] + "," + v["chn1"] + "," + v["chn2"] + "," + v["chn3"], "XQHID": v["mmark"], "DAYS": v["days"], "YXDAYS": v["yxdays"] });
                    });
                    var mlevel;
                    var marker;
                    var ptt = "";
                    if (markers.length > 0) {
                        if (markerClusterer != null) {
                            markerClusterer.removeMarkers(markers);
                            markerClusterer = null;
                        }
                        markers = [];
                    }
                    for (var i = 0; i < data_info.length; i++) {
                        mlevel = data_info[i].mlevel;
                        ptt = new BMap.Point(data_info[i].lng, data_info[i].lat);
                        if (mlevel == 'CBD')
                            marker = new BMap.Marker(ptt, { icon: icon4 });
                        else if (mlevel == 'YBQ')
                            marker = new BMap.Marker(ptt, { icon: icon3 });
                        else if (mlevel == 'XQH')
                            marker = new BMap.Marker(ptt, { icon: icon2 });
                        else
                            marker = new BMap.Marker(ptt, { icon: icon1 });

                        var did = data_info[i].devid;
                        var xqh = data_info[i].XQHID;
                        var d = data_info[i].DAYS;
                        var yxd = data_info[i].YXDAYS;
                        map.addOverlay(marker);
                        var notes = data_info[i].note;
                        label = new BMap.Label(data_info[i].mname, { offset: new BMap.Size(20, -10) });
                        marker.setLabel(label);
                        markers.push(marker);
                        addClickHandler(did, notes, xqh,d,yxd, marker);
                    }
                    if (markers.length > 0)
                        markerClusterer = new BMapLib.MarkerClusterer(map, { markers: markers });//对地图扩大缩小后会都所有的点全显示出来。
                    if (scounty != "")
                        map.centerAndZoom(scounty, 12);
                    else if (scity != "")
                        map.centerAndZoom(scity, 10);
                    else if (sprovince != "")
                        map.centerAndZoom(sprovince, 8);
                    else
                        map.centerAndZoom("西安", 5);
                    if (areas != "")
                        getBoundary(areas);
                    renderstation();
                }
            });
        }


        function addClickHandler(did, notes, xqh,d,yxd, marker) {
            marker.addEventListener("click", function (e) {
                showawsinfectInfo(did, notes, xqh,d,yxd);
            }
            );
        }
        function InitTree() {
            $('#pt').tree({
                width: '100%', //宽度 
                lines: true,
                //data: provincetree,   
                url: '../areainfo/GetArea.ashx', //请求数据的页面 
                method: 'post',
                queryParams: { "action": "querymyareauser" },
                onBeforeExpand: function (node) {
                    $("#pt").tree("options").queryParams = { "action": "queryyb" };
                    $('#pt').tree('options').url = "../areainfo/GetArea.ashx?pid=" + node.id;
                },
                onClick: function (node) {
                    if (node.text != "") {
                        sebm = node.bm;
                        //获取地区全称
                        if (sebm == "0")
                            areas = "";
                        else if (sebm.length == 6 && sebm.indexOf("0000")) {
                            areas = node.text;
                        }
                        else {
                            var result = $.ajax({
                                url: "../areainfo/GetArea.ashx?action=queryarea",
                                type: 'post',
                                dataType: 'json',
                                async: false,
                                cache: false
                            }).responseText;
                            areas = result;
                        }
                        reloadgridTree();
                    }

                },
                onLoadSuccess: function (node, param) {

                }
            });
            $('#hzgrid').datagrid({
                title: '虫情', //表格标题
                url: '../devinfo/GetStatus.ashx', //请求数据的页面
                sortName: 'devid', //排序字段
                idField: '', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
                height: 400,
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                queryParams: { "action": "HZYBQ", "sebm": sebm, "StartTime": $("#txtstart").datebox("getValue"), "EndTime": $("#txtend").datebox("getValue") },
                method: 'post',
                columns: [[//							                    
                   { title: '设备编号', field: 'DevID', width: 60, sortable: true },
	                { title: '设备名称', field: 'devname', width: 80 },
                    {
                        title: '虫情', field: 'a', width: 280, formatter: function (v, d, i) {
                            var r = "";
                            if (d.chn0 != "" && d.chn0 != null) r = r + d.chn0 + "(" + d.ch0 + ")";
                            if (d.chn1 != "" && d.chn1 != null) r = r + d.chn1 + "(" + d.ch1 + ")";
                            if (d.chn2 != "" && d.chn2 != null) r = r + d.chn2 + "(" + d.ch2 + ")";
                            if (d.chn3 != "" && d.chn3 != null) r = r + d.chn3 + "(" + d.ch3 + ")";
                            return r;
                        }
                    },
                    { title: '地址', field: 'DevLocation', width: 220 }
                ]
                ],
                toolbar: "#hztoolbar",
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                rownumbers: true

            });
        }
        function showawsinfectInfo(did, notes, xqh,d,yxd) {
            devid = did;
            ch = notes.split(',');
            XQHID = xqh;
            days = d;
            yxdays = yxd;
            addTab(devid, 'mywin.html');
        }

        function reloadgrid() {
            var queryParams = $('#hzgrid').datagrid('options').queryParams;
            var StartTime = $("#txtstart").datebox("getValue");
            var EndTime = $("#txtend").datebox("getValue");

            queryParams.StartTime = StartTime;
            queryParams.EndTime = EndTime;
            queryParams.sebm = sebm;

            $('#hzgrid').datagrid('options').queryParams = queryParams;
            $("#hzgrid").datagrid('reload');

        }

        function showxc() {
            Highcharts.setOptions({
                lang: {
                    contextButtonTitle: "图表导出菜单",
                    decimalPoint: ".",
                    downloadJPEG: "下载JPEG图片",
                    downloadPDF: "下载PDF文件",
                    downloadPNG: "下载PNG文件",
                    downloadSVG: "下载SVG文件",
                    drillUpText: "返回 {series.name}",
                    loading: "加载中",
                    months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                    noData: "没有数据",
                    numericSymbols: ["千", "兆", "G", "T", "P", "E"],
                    printChart: "打印图表",
                    resetZoom: "恢复缩放",
                    resetZoomTitle: "恢复图表",
                    shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                    thousandsSep: ",",
                    weekdays: ["星期一", "星期二", "星期三", "星期三", "星期四", "星期五", "星期六", "星期天"]
                }
            });
            Minit();
            InitGrid();
            ChartJS.init(ch[0], ch[1], ch[2], ch[3]);
            $('#a_weather').click(XQH.show);
            //showavg
            $('#a_weatheravg').click(XQH.showavg);
            $('#a_weathermavg').click(XQH.showmavg);
            $('#a_search').click(InitGrid);            
            $("#yjfx").panel({
                href: '../html/alarmall.html',
                title: '靶标害虫预警信息',
                tools: [{ iconCls: 'icon-phone', handler: function () { sendAlarm('虫情预警'); } }],
                onLoad: function () {
                    InitSendUser();
                    $("#btnyj").click(function () {
                        sendAlarm('虫情预警');
                    });

                }

            });
            

        }        
       
        function InitGrid() {
            var avg = $("#avg").combobox('getValue');            ;
            var h = $("#my1").height();
            var w = $("#my1").width();
            var cols = "[[{ title: '设备ID', field: 'devID', width: 100, align: 'center' },"
            if (ch[0] != "")
                cols = cols + "{ title:'" + ch[0] + "', field: 'ch0', width: 80, align: 'center' },";
            if (ch[1] != "")
                cols = cols + "{ title:'" + ch[1] + "', field: 'ch1', width: 80, align: 'center' },";
            if (ch[2] != "")
                cols = cols + "{ title:'" + ch[2] + "', field: 'ch2', width: 80, align: 'center' },";
            if (ch[3] != "")
                cols = cols + "{ title:'" + ch[3] + "', field: 'ch3', width: 80, align: 'center' },";
            if(avg=="")
                cols = cols + "{ title: '经度', field: 'yjd', width: 150, align: 'center' },{ title: '纬度', field: 'ywd', width: 150, align: 'center' },{ title: '海拔', field: 'yhb', width: 150, align: 'center' },";
            cols=cols+"{ title: '更新时间', field: 'updateTime', width: 150, align: 'center' }]]";

            $('#histList').datagrid({
                toolbar: '#toolbarm',
                url: '../devinfo/GetStatus.ashx?action=query&type=YBQ&avg='+avg,
                title: "设备已正常运行"+days+"天，还有"+yxdays+"天需要更换诱蕊。",
                iconCls: 'icon icon-list',
                height: h,
                width: w,
                nowrap: true, //折行
                rownumbers: true, //行号
                striped: true, //隔行变色
                idField: 'keyid', //主键
                singleSelect: true, //单选
                fitColumns: true,
                queryParams: { devID: devid, "StartTime": $("#StartTime").datebox("getValue"), "EndTime": $("#EndTime").datebox("getValue") },
                columns: eval(cols),
                pagination: true,
                pageSize: 10,
                onLoadSuccess: function (data) {
                    var mt = "";
                    var md;
                    tc1 = "";
                    tc2 = "";
                    tc3 = "";
                    tc4 = "";
                    $.each(data.rows, function (k, v) {
                        mt = v["updateTime"];
                        mt = mt.replace(/-/g, "/");
                        md = Date.parse(mt);
                        tc1 += "[" + md + "," + v["ch0"] + "],";
                        tc2 += "[" + md + "," + v["ch1"] + "],";
                        tc3 += "[" + md + "," + v["ch2"] + "],";
                        tc4 += "[" + md + "," + v["ch3"] + "],";
                    });
                    tc1 = "[" + tc1 + "]";
                    tc2 = "[" + tc2 + "]";
                    tc3 = "[" + tc3 + "]";
                    tc4 = "[" + tc4 + "]";
                    var n = chs.length;

                    var num = 0;
                    if (ch[0] != "") {
                        wchartInstance.series[n + num].setData(eval(tc1));
                        num = num + 1;
                    }
                    if (ch[1] != "") {
                        wchartInstance.series[n + num].setData(eval(tc2));
                        num = num + 1;
                    }
                    if (ch[2] != "") {
                        wchartInstance.series[n + num].setData(eval(tc3));
                        num = num + 1;
                    }
                    if (ch[3] != "") {
                        wchartInstance.series[n + num].setData(eval(tc4));
                        num = num + 1;
                    }
                    //分析结果
                    griddata = data;
                    var max = 0;
                    var min = 0;
                    var sum = 0;
                    var pets = "";
                    var temp = 0;
                    var nums = 0;
                    var maxt = "";
                    var mint = "";
                    var sresult = "";
                    var snum = 0;
                    var result = "";
                    dtOpstart = $("#StartTime").datebox("getValue");
                    dtOpend = $("#EndTime").datebox("getValue");
                    num = 0;
                    if (ch[0] != "") {

                        num = num + 1;
                        pets = pets + ch[0];
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch0"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch[0] + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch[1] != "") {
                        pets = pets + ch[1];
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch1"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch[1] + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch[2] != "") {
                        pets = pets + ch[2];
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch2"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch[2] + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (ch[3] != "") {
                        pets = pets + ch[3];
                        num = num + 1;
                        max = 0;
                        sum = 0;
                        maxt = "";
                        mint = "";
                        snum = 0;
                        sresult = "";
                        $.each(data.rows, function (k, v) {
                            temp = parseInt(v["ch3"]);
                            if (temp >= max) { max = temp; maxt = v["updateTime"]; }
                            sum = sum + temp;
                        });
                        result = result + "其中" + ch[3] + "，最大数为：" + max + ",发生日期是：" + maxt + "。";
                    }
                    if (dtOpstart != "") dtOpstart = dtOpstart + "到";
                    if (dtOpend != "") dtOpstart = dtOpstart + dtOpend;
                    result = dtOpstart + "，" + uid + "靶标害虫中害虫" + num + "种，分别为：" + pets + "。" + result;
                    $('#mmark').val(result);
                },
                pageList: [10, 20, 40, 50, 10000]
            });
        }
        function Minit() {
            if (XQHID != "" && XQHID != null)
                jQuery.getJSON('../devinfo/GetStatus.ashx?action=getxqh&XQHID=' + XQHID + '&r=' + Math.floor(Math.random() * (1000 + 1)), null, function (data) {

                    chs = data.XQHID.split(',');
                    chs.deleteElementByValue("风向");
                    if (chs.length != 0)
                        winit(chs, ch[0], ch[1], ch[2], ch[3]);
                });
            else
                winit(chs, ch[0], ch[1], ch[2], ch[3]);
        }

        function winit(chs, ch1, ch2, ch3, ch4) {
            var s = "[";
            $.each(chs, function () {
                s = s + "{name:'" + this + "',yAxis: 1,data:[]},";
            });
            if (ch1 != "")
                s = s + "{name:'" + ch1 + "',data:[]},";
            if (ch2 != "")
                s = s + "{name:'" + ch2 + "',data:[]},";
            if (ch3 != "")
                s = s + "{name:'" + ch3 + "',data:[]},";
            if (ch4 != "")
                s = s + "{name:'" + ch4 + "',data:[]}";
            if (s.substring(s.length - 1, s.length) == ",")
                s = s.substr(0, s.length - 1);
            s = s + "]";
            wchartInstance = new Highcharts.Chart({
                chart: {
                    renderTo: 'chartArea',
                    type: 'line'
                },
                credits: {
                    enabled: false
                },
                exporting: {
                    enabled: true
                },
                title: {
                    text: '关联曲线分析',
                    x: -20 //center
                },
                plotOptions: {
                    series: {
                        events: {
                            legendItemClick: function () {
                                var visibility = this.visible ? 'visible' : 'hidden';
                                if (visibility == 'hidden') {
                                    for (var i = 0; i < chs.length; i++) {
                                        wchartInstance.series[i].hide();

                                    }
                                    //wchartInstance.series
                                }
                                return true;
                            }
                        }
                    }
                },
                xAxis: {
                    type: 'datetime',
                    labels: {
                        step: 4,
                        formatter: function () {
                            return new Date(this.value).toLocaleDateString();
                        }
                    }
                },
                yAxis: [{
                    title: {
                        text: '虫子数值'
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#808080'
                    }]
                },
                {
                    title: {
                        text: '气象数值'
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#89A54E'
                    }],
                    opposite: true
                }],
                tooltip: {
                    //valueSuffix: '',
                    formatter: function () {
                        var sname = this.series.name;
                        if (sname.substr(sname.length - 1, 1) == '度')
                            return '<b>' + sname + '：</b>' + this.y + '℃<br/> <b>时间：</b>' + new Date(this.x).toLocaleString();
                        else
                            return '<b>' + sname + '：</b>' + this.y + '<br/> <b>时间：</b>' + new Date(this.x).toLocaleString();
                    }

                },
                legend: {
                    layout: 'vertical',
                    align: 'right',
                    verticalAlign: 'middle',
                    borderWidth: 0
                },
                series: eval(s)
            });
            for (var i = 0; i < chs.length; i++) {
                wchartInstance.series[i].hide();

            }
            wchartInstance.series[0].show();
        }
        var ChartJS = {
            init: function (ch1, ch2, ch3, ch4) {
                var s = "[";
                if (ch1 != "")
                    s = s + "{name:'" + ch1 + "',data:[]},";
                if (ch2 != "")
                    s = s + "{name:'" + ch2 + "',data:[]},";
                if (ch3 != "")
                    s = s + "{name:'" + ch3 + "',data:[]},";
                if (ch4 != "")
                    s = s + "{name:'" + ch4 + "',data:[]}";
                if (s.substring(s.length - 1, s.length) == ",")
                    s = s.substr(0, s.length - 1);
                s = s + "]";
                chartInstance = new Highcharts.Chart({
                    chart: {
                        renderTo: 'chartArea',
                        type: 'line'
                    },
                    credits: {
                        enabled: false
                    },
                    exporting: {
                        enabled: true
                    },
                    title: {
                        text: '请设置设备的小气候数据',
                        x: -20 //center
                    },
                    xAxis: {
                        type: 'datetime',
                        labels: {
                            //step: 4,
                            formatter: function () {
                                return new Date(this.value).toLocaleDateString();
                            }
                        }
                    },
                    yAxis: {
                        title: {
                            text: '数量 (只)'
                        },
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080'
                        }]
                    },
                    tooltip: {
                        valueSuffix: '只',
                        formatter: function () {
                            return '<b>' + this.series.name + '：</b>' + this.y + '只<br/> <b>时间：</b>' + new Date(this.x).toLocaleString();
                            //return '<b>' + this.series.name + '：</b>' + this.y + '只<br/> <b>时间：</b>' + this.x;
                        }

                    },
                    legend: {
                        layout: 'vertical',
                        align: 'right',
                        verticalAlign: 'middle',
                        borderWidth: 0
                    },
                    series: eval(s)
                });
            }
        };
        var XQH = {
            init: function () {
                dtOpstart = $("#StartTime").datebox("getValue");
                dtOpend = $("#EndTime").datebox("getValue");
            },
            showavg: function () {
                if (XQHID == "") {
                    $.messager.alert("提示", "对不起，这个设备没有小气候数据！", "info");
                    return;
                }
                XQH.init();
                //var rows = $('#histList').datagrid('getPager').data("pagination").options.pageSize;
                jQuery.getJSON('../devinfo/GetStatus.ashx?action=XQHA&devID=' + XQHID + '&StartTime=' + dtOpstart + '&EndTime=' + dtOpend + '&page=1&rows=1000&r=' + Math.floor(Math.random() * (1000 + 1)), null, function (data) {
                    //$('#histList').datagrid('loadData',data);      
                    var md;
                    var t1 = "";
                    var n = chs.length;
                    for (var i = 0; i < n; i++) {
                        t1 = "";
                        $.each(data.rows, function (k, v) {
                            md = v["datetime"];
                            md = md.replace(/-/g, "/");
                            md = Date.parse(md);
                            t1 = "[" + md + "," + v[chs[i]] + "]," + t1;

                        });
                        t1 = "[" + t1 + "]";
                        wchartInstance.series[i].setData(eval(t1));
                    }
                });


            },
            showmavg: function () {
                if (XQHID == "") {
                    $.messager.alert("提示", "对不起，这个设备没有小气候数据！", "info");
                    return;
                }
                XQH.init();
                //var rows = $('#histList').datagrid('getPager').data("pagination").options.pageSize;
                jQuery.getJSON('../devinfo/GetStatus.ashx?action=XQHM&devID=' + XQHID + '&StartTime=' + dtOpstart + '&EndTime=' + dtOpend + '&page=1&rows=1000&r=' + Math.floor(Math.random() * (1000 + 1)), null, function (data) {
                    //$('#histList').datagrid('loadData',data);    
                    var md;
                    var t1 = "";
                    var n = chs.length;
                    for (var i = 0; i < n; i++) {
                        t1 = "";
                        $.each(data.rows, function (k, v) {
                            md = v["datetime"] + "-01";
                            md = md.replace(/-/g, "/");
                            md = Date.parse(md);
                            t1 = "[" + md + "," + v[chs[i]] + "]," + t1;

                        });
                        t1 = "[" + t1 + "]";
                        wchartInstance.series[i].setData(eval(t1));
                    }
                });


            },
            show: function () {
                if (XQHID == "") {
                    $.messager.alert("提示", "对不起，这个设备没有小气候数据！", "info");
                    return;
                }
                XQH.init();
                if (chs.length == 0) {
                    $.messager.alert("提示", "对不起，这个设备小气候参数为空！", "info");

                    return;
                }
                //if (chs.length != 0)
                //    WChartJS.init(chs, ch[0], ch[1], ch[2], ch[3]);
                //else
                //    $.messager.alert("提示", "对不起，这个设备小气候参数为空！", "info");

                //var rows = $('#histList').datagrid('getPager').data("pagination").options.pageSize;
                jQuery.getJSON('../devinfo/GetStatus.ashx?action=XQH&devID=' + XQHID + '&StartTime=' + dtOpstart + '&EndTime=' + dtOpend + '&page=1&rows=1000&r=' + Math.floor(Math.random() * (1000 + 1)), null, function (data) {

                    var md;
                    var t1 = "";
                    var n = chs.length;
                    for (var i = 0; i < n; i++) {
                        t1 = "";
                        $.each(data.rows, function (k, v) {
                            md = v["datetime"];
                            md = md.replace(/-/g, "/");
                            md = Date.parse(md);
                            t1 = "[" + md + "," + v[chs[i]] + "]," + t1;
                        });
                        t1 = "[" + t1 + "]";
                        wchartInstance.series[i].setData(eval(t1));
                    }
                    var num = 0;
                    if (ch[0] != "") {
                        wchartInstance.series[n + num].setData(eval(tc1));
                        num = num + 1;
                    }
                    if (ch[1] != "") {
                        wchartInstance.series[n + num].setData(eval(tc2));
                        num = num + 1;
                    }
                    if (ch[2] != "") {
                        wchartInstance.series[n + num].setData(eval(tc3));
                        num = num + 1;
                    }
                    if (ch[3] != "") {
                        wchartInstance.series[n + num].setData(eval(tc4));
                        num = num + 1;
                    }

                });
            }
        };
       
    </script>
    <script id="tmpstations" type="text/html">
        {{each rows as value index}}
        <div class="stations">
            <div class="level1Div" onclick="showawsinfectInfo('{{value.DevID}}','{{value.chn0}},{{value.chn1}},{{value.chn2}},{{value.chn3}}','{{value.mmark}}','{{value.days}}','{{value.yxdays}}')">
                <div class="levelsb">{{value.devname}}</div>
                <div class="leveltime">时间：{{value.mdatetime}} 已运行{{value.days}}天</div>
                <div class="levelbottom">
                    <div class="levelpet">{{value.updata}}<br />{{value.updateTime}}</div>                   
                </div>
            </div>
        </div>
        {{/each}} 
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="mainDiv">
        <uc1:checkright runat="server" ID="checkright" />
        <uc1:spet runat="server" ID="spet" />

        <div id="contentDiv">
            <div class="mypt">
                <ul id="pt"></ul>
            </div>
            <div id="mycontent">
                <div id="tab" class="easyui-tabs">
                    <div title="GSI" style="padding: 5px;">
                        <div style="position: relative;">
                            <div id="mymap"></div>
                            <div id="Maptype" style="height: 87px; width: 130px; position: absolute; float: left; margin-left: 850px; top: 50px; z-index: 99; color: Black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px;">
                                <input id="CBstationname" onclick="ShowstationName('checkbox')" checked="checked" style="float: left; margin-left: 10px;"
                                    type="checkbox" />
                                <label onclick="ShowstationName('label')" style="height: 20px; width: 100px; float: left; text-align: left; font-size: 13px; font-family: 宋体; font-weight: bold; margin-top: 3px; cursor: pointer;">
                                    显示名称</label>
                            </div>
                        </div>

                    </div>
                    <div title="设备列表" style="overflow: auto; padding: 5px;">
                        <div id="mystations"></div>
                    </div>
                    <div title="汇总" style="padding: 5px;">
                        <div id="hz">
                                <table id="hzgrid"></table>
                                <div id="hztoolbar">
                                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                                        <tr>
                                            <td style="padding-left: 2px">

                                                <div style="padding: 2px;">
                                                    时间从:  
           <input id="txtstart" class="easyui-datebox" style="width: 100px" />
                                                    到:  
           <input id="txtend" class="easyui-datebox" style="width: 100px" />
                                                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reloadgrid()">查找</a>

                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>

                            </div>

                    </div>
                </div>
            </div>
            <div style="clear: both;"></div>
        </div>
        <uc1:copyright runat="server" ID="copyright" />

    </div>
    
</asp:Content>
